<%@ page language="java" pageEncoding="utf8"%>
<%@ page isELIgnored="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>DataBaseList</title>
		<link href="tablecloth/tablecloth.css" rel="stylesheet"
			type="text/css" media="screen" />
		<script type="text/javascript" src="tablecloth/tablecloth.js"></script>
		<script type="text/javascript" src="js/splitpage.js"></script>
		<link href="css/splitpage.css" rel="stylesheet"
			type="text/css" media="screen" />
		<style type="text/css">
			<!--
			.STYLE1 {
				font-family: "宋体";
				font-size: small;
				color: #999999;
			}
			
			.STYLE2 {
				font-size: small
			}
			-->
		</style>
	</head>
	<body>
		<div align="center">
			<img src="image/temp.jpg" alt="首页" width="100%" height="70"
				align="middle">
		</div>
		<table width="100%" border="0" style="">
          <tr>
            <td width="20%"><span class="STYLE1">当前位置—<a href="redirect.do?method=welcome">首页</a>—数据库列表</span></td>
            <form action="mgrdatabase.do?method=mgrDatabaseList" method="post">
            <td width="50%" valign="middle">
	            <span><div align="center" class="STYLE3">
	            	<input type="text" id="dbName" name="dbName"/>&nbsp;<input type="submit" value="数据库查询"/>
	            </div>
	            </span>
            </td>
            </form>
            <td width="30%"><div align="right" class="STYLE2">
            <c:if test="${map.machineId!=0}"><a href="redirect.do?method=adddatabase&machineId=${map.machineId}">添加数据库</a></c:if>
			<a href="mgrmachine.do?method=mgrMachineList">机器信息列表</a>&nbsp;<a href="redirect.do?method=welcome">首页</a>&nbsp;<a href="logout.do">退出 </a>
		</div></td>
          </tr>
        </table>
		
		<table cellspacing="0" cellpadding="0">
			<tr>
				<th>
					DBName
				</th>
				<th>
					Machine
				</th>
				<th>
					OLT
				</th>
				<th >
					DBVersion
				</th>
				<th>
					OS
				</th>
				<th>
					Port
				</th>
				<th>
					Engine
				</th>
				<th>
					CharSet
				</th>
				<th>
					Project
				</th>
				<th>
					Apply
				</th>
				<th>
					TableCount
				</th>
				<th>
					IsMaster
				</th>
				<th>
					Partition
				</th>
				<th>
					Edit
				</th>
			</tr>
			<c:forEach var="db" items="${map.dtoList}">
				<tr>
					<td>
						<c:out value="${db.dbName}" />
					</td>
					<td>
						<a href="redirect.do?method=adddatabase&machineId=${db.mgrMachineId}" title="在此机器添加数据库"><c:out value="${db.ip}" /></a>
					</td>
					<td>
						<c:out value="${db.onlineTime}" />
					</td>
					<td>
						<c:out value="${db.dbVersion}" />
					</td>
					<td>
						<c:out value="${db.operationSystem}" />
					</td>
					<td>
						<c:out value="${db.dbPort}" />
					</td>
					<td>
						<c:out value="${db.dbEngine}" />
					</td>
					<td>
						<c:out value="${db.dbCharacterSet}" />
					</td>
					<td>
						<c:out value="${db.projectName}" />
					</td>
					<td>
						<c:out value="${db.applyPerson}" />
					</td>
					<td>
						<c:out value="${db.tableCount}" />
					</td>
					<td>
						<c:if test="${db.isMaster}"><a href="#" title="查看从服务器"><c:out value="Yes"/></a></c:if>
						<c:if test="${!db.isMaster}"><a href="#" title="添加从服务器"><c:out value="No"/></a></c:if>
					</td>
					<td>
						<c:if test="${db.usePartition}"><c:out value="Yes"/></c:if>
						<c:if test="${!db.usePartition}"><c:out value="No"/></c:if>
					</td>
					<td>
						<img align="middle" title="编辑" src="image/btn_edit.jpg" onclick="window.location.href='mgrdatabase.do?method=editMgrDatabase&dbid=${db.id}'" style="cursor:pointer">
						<img align="middle" title="删除" src="image/btn_delete.jpg" onclick="window.location.href='mgrdatabase.do?method=deleteMgrDatabase&dbid=${db.id}&index=${map.index}&machineId=${db.mgrMachineId}'" style="cursor:pointer">
						<img align="middle" title="禁用" src="image/btn_lock.jpg" onclick="window.location.href='mgrdatabase.do?method=disableMgrDatabase&dbid=${db.id}&index=${map.index}&machineId=${db.mgrMachineId}'" style="cursor:pointer">
					</td>
				</tr>
			</c:forEach>
		</table>
		<div id="pager" style="padding-top:10px;padding-bottom:10px;background-color:#328aa4;"></div>
		<script type="text/javascript">
			var pager = new PagerView('pager');
			pager.itemCount = "${map.totalCount}";
			pager.size = "${map.limit}";
			pager.index = "${map.index}";
			pager.onclick = function(index){
				window.location.href = "mgrdatabase.do?method=mgrDatabaseList&index="+index+"&machineId=${map.machineId}";
			};
			pager.render();
		</script>
					
		
	</body>
</html>
